package com.huawei.Galenus.service.impl;

import com.huawei.Galenus.dao.UserRepository;
import com.huawei.Galenus.domain.User;
import com.huawei.Galenus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("UserService")
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public Integer save(User user) {
        return userRepository.save(user);
    }

    @Override
    public User findByUsername(String username) {
        return userRepository.findByUsername(username);
    }

    @Override
    public User findById(String id) {
        return userRepository.findById(id);
    }

    @Override
    public List<User> getSingers() {
        return userRepository.selectSingers();
    }

    @Override
    public Integer changeType(String uid) {
        return userRepository.updateType(uid);
    }

    @Override
    public int beMember(String uid) {
        return userRepository.beMember(uid);
    }

    @Override
    public int enjoy(String uid, int amount) {
        return userRepository.enjoy(uid, amount);
    }
}
